<template>
  <div>
    <p style="font-size: 25px; text-align: center; color: #000">仓库管理</p>
    <table>
      <tr>
        <td>*仓库名称</td>
        <td>
          <el-input v-model="addinfo.title" style="width: 85%" />
        </td>
        <td>仓库编号</td>
        <td>
          <el-input v-model="addinfo.code" style="width: 85%" />
        </td>
      </tr>
      <tr>
        <td>*仓库管理员</td>
        <td colspan="3">
          <el-input v-model="addinfo.name" style="width: 85%" />
          <el-button color="rgb(66, 161, 220)" style="color: #fff">x&nbsp;&nbsp;选择</el-button>
        </td>
      </tr>
      <tr>
        <td>仓库地址</td>
        <td>
          <el-input v-model="addinfo.position" style="width: 85%" />
        </td>
        <td>*排序号</td>
        <td>
          <el-input v-model="addinfo.serial" style="width: 85%" />
        </td>
      </tr>
      <tr>
        <td>说明</td>
        <td colspan="3">
          <el-input
            v-model="addinfo.context"
            style="width: 90%"
            :rows="5"
            type="textarea"
          />
        </td>
      </tr>
    </table>
    <div class="dialog-footer">
      <el-button type="primary" @click="setupdate()"> 保存(S) </el-button>
    </div>
  </div>
</template>
    
<script setup>
import { ref, reactive, onMounted, computed, watch } from "vue";
import { useRouter, RouterView, useRoute } from "vue-router";
import { ElMessage } from "element-plus";
import Axios from "axios";
const router = useRouter();
const route = useRoute();
const addinfo = ref([]);
onMounted(() => {
  getupdateList();
});
const getupdateList = () => {
  addinfo.value = JSON.parse(localStorage.getItem("update_item"));
};
const setupdate = () => {
  Axios.post("http://127.0.0.1:3000/admin/update", addinfo.value).then(
    (res) => {
      if (res.data.code == 200) {
        // 提示
        ElMessage({
          message: "修改成功",
          type: "success",
        });
      }
    }
  );
};
</script>
    
<style scoped>
table {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
}
td {
  border: 1px solid #ccc;
  text-align: center;
  line-height: 40px;
  height: 40px;
  padding-left: 10px;
}
.table1 tr:hover {
  background-color: #ccc;
}
th {
  border: 1px solid #ccc;
  text-align: center;
  line-height: 40px;
  height: 40px;
  padding: 10px;
}
</style>